<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="xbsj-labels" content="EarthUI示例"></meta>
    <title>天地图</title>
    <script src="../../XbsjEarthUI/xbsj.js"></script>
    <style>
        html,
        body {
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
        }
    </style>
</head>

<body>
    <div id="main">
    </div>

    <script>
        XbsjEarthUI.create('main').then(earthUI => {

            var imageryskin = [
                {
                    url: '//t6.tianditu.com/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=835402675b4eef1d10ff69553d33801f',
                    title: '天地图影像'
                },
                {
                    url: '//t6.tianditu.com/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=835402675b4eef1d10ff69553d33801f',
                    title: '天地图影像标注'
                },
                {
                    url: '//t6.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=835402675b4eef1d10ff69553d33801f',
                    title: '天地图地图'
                },
                {
                    url: '//t3.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=835402675b4eef1d10ff69553d33801f',
                    title: '天地图地图标注'
                }
            ];

            var children = [];
            imageryskin.forEach((value,index) => {
                children.push({
                        "czmObject": {
                            "xbsjType": "Imagery",
                            "name": value.title,
                            "xbsjImageryProvider": {
                                "XbsjImageryProvider": {
                                    "url": value.url
                                }
                            }
                        },
                        "enabled": true
                });
            })

            earthUI.earth.sceneTree.root = {
                "expand": true,
                "title": "影像",
                "children": [{
                    "expand": true,
                    "title": "地图",
                    "children": children
                }]
            };
                
            // 打开影像工具栏
            earthUI.controls.mainBar.page = "imagery";
            // only for Debug
            window.uia = earthUI;
        });
    </script>
</body>

</html>